# RUN: tf-mlir-translate -graphdef-to-mlir -tf-enable-shape-inference-on-import=false -mlir-print-debuginfo %s -o - | FileCheck %s

node {
  name: "x"
  op: "Const"
  device: "/device:CPU:0"
  attr {
    key: "dtype"
    value {
      type: DT_FLOAT
    }
  }
  attr {
    key: "value"
    value {
      tensor {
        dtype: DT_FLOAT
        tensor_shape {
          dim {
            size: 3
          }
          dim {
            size: 5
          }
          dim {
            size: 4
          }
          dim {
            size: 2
          }
        }
      }
    }
  }
}
node {
  name: "m"
  op: "Const"
  device: "/device:CPU:0"
  attr {
    key: "dtype"
    value {
      type: DT_FLOAT
    }
  }
  attr {
    key: "value"
    value {
      tensor {
        dtype: DT_FLOAT
        tensor_shape {
          dim {
            size: 2
          }
        }
        tensor_content: "\350\251\242>\276\335r?"
      }
    }
  }
}
node {
  name: "v"
  op: "Const"
  device: "/device:CPU:0"
  attr {
    key: "dtype"
    value {
      type: DT_FLOAT
    }
  }
  attr {
    key: "value"
    value {
      tensor {
        dtype: DT_FLOAT
        tensor_shape {
          dim {
            size: 2
          }
        }
        tensor_content: "\315\221\342>\206\317\256>"
      }
    }
  }
}
node {
  name: "beta"
  op: "Const"
  device: "/device:CPU:0"
  attr {
    key: "dtype"
    value {
      type: DT_FLOAT
    }
  }
  attr {
    key: "value"
    value {
      tensor {
        dtype: DT_FLOAT
        tensor_shape {
          dim {
            size: 2
          }
        }
        tensor_content: "\261OI?\224);>"
      }
    }
  }
}
node {
  name: "gamma"
  op: "Const"
  device: "/device:CPU:0"
  attr {
    key: "dtype"
    value {
      type: DT_FLOAT
    }
  }
  attr {
    key: "value"
    value {
      tensor {
        dtype: DT_FLOAT
        tensor_shape {
          dim {
            size: 2
          }
        }
        tensor_content: "\364\254\206>\034\266\037?"
      }
    }
  }
}
# BatchNormWithGlobalNormalization op is invalid in version 9.
node {
  name: "BatchNormWithGlobalNormalization"
  op: "BatchNormWithGlobalNormalization"
  input: "x"
  input: "m"
  input: "v"
  input: "beta"
  input: "gamma"
  device: "/device:CPU:0"
  attr {
    key: "T"
    value {
      type: DT_FLOAT
    }
  }
  attr {
    key: "scale_after_normalization"
    value {
      b: false
    }
  }
  attr {
    key: "variance_epsilon"
    value {
      f: 0.001
    }
  }
}
library {
}
# versions would be modeled as tf.versions attribute in main function
versions {
  producer: 8
  min_consumer: 7
  bad_consumers: 3
  bad_consumers: 4
  bad_consumers: 2
  bad_consumers: 9
}

# Find module attributes and verify tf.versions attribute
# CHECK: module attributes
# CHECK-SAME: tf.versions = {bad_consumers = [3 : i32, 4 : i32, 2 : i32, 9 : i32], min_consumer = 7 : i32, producer = 8 : i32}
